import { _decorator, Component, Node, Prefab } from "cc";
const { ccclass, property } = _decorator;
import { BulletEnum } from "../Enum/BulletEnum";
import { StateMachineBase } from "../Base/StateMachineBase";
import { MoreBulletState } from "./MoreBulletState";
import { NormalBulletState } from "./NormalBulletState";
import { SpeedBulletState } from "./SpeedBulletState";

@ccclass("BulletStateMachine")
export class BulletStateMachine extends StateMachineBase<BulletEnum> {
  @property(Prefab)
  prefab: Prefab;
  onLoad() {
    // 注册子弹状态
    this.registerState(BulletEnum.Normal, new NormalBulletState(this.prefab));
    this.registerState(BulletEnum.More, new MoreBulletState(this.prefab));
    this.registerState(BulletEnum.Speed, new SpeedBulletState(this.prefab));
    // 初始化为普通子弹状态
    this.changeState(BulletEnum.Normal);
  }
  update(dt: number) {
    super.update(dt);
  }
  changeState(state: BulletEnum) {
    super.changeState(state);
  }
}
